class Car(
    val licensePlate: String,
    val brand: String,
    val color: String,
    val price: Double
) {
  def drive(): Unit = println(s"$brand is driving")
  def park(): Unit = println(s"$brand is parked")
  def refuel(): Unit = println(s"$brand is refueling")
}

class ElectricCar(
    licensePlate: String,
    brand: String,
    color: String,
    price: Double,
    val batteryCapacity: Double,
    var remainingRange: Double
) extends Car(licensePlate, brand, color, price) {

  def charge(): Unit = {
    println(s"$brand is charging")
    remainingRange = batteryCapacity
  }

  override def drive(): Unit = {
    if (remainingRange > 0) {
      println(s"$brand electric car is driving")
      remainingRange -= 10
      if (remainingRange < 0) remainingRange = 0
    } else {
      println(s"$brand cannot drive: no remaining range")
    }
  }
}
